package org.dingyom.market.service.impl;

import org.dingyom.basics.util.LoginContext;
import org.dingyom.market.domain.ClueRemark;
import org.dingyom.market.service.IClueRemarkService;
import org.dingyom.basics.service.impl.BaseServiceImpl;
import org.dingyom.org.domain.Employee;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author dingyom
 * @since 2022-08-25
 */
@Service
public class ClueRemarkServiceImpl extends BaseServiceImpl<ClueRemark> implements IClueRemarkService {

    @Override
    public void add(ClueRemark clueRemark) {
        //获取创建人信息 就是当前登陆的用户
        Employee loginUser = LoginContext.getLoginUser();
        clueRemark.setCreateBy(loginUser);
        //获取创建时间
        clueRemark.setCreateTime(new Date());
        super.add(clueRemark);
    }

    @Override
    public void modify(ClueRemark clueRemark) {
        //获取修改人员信息 当前登陆的用户信息
        Employee loginUser = LoginContext.getLoginUser();
        clueRemark.setEditBy(loginUser);
        //获取修改时间
        clueRemark.setEditTime(new Date());
        //设置修改标志
        clueRemark.setEditFlag("修改人员"+loginUser.getUsername());
        super.modify(clueRemark);
    }
}
